package com.sxw.hw_student.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxw.hw_student.system.entity.SysUserRole;
import com.sxw.hw_student.system.mapper.SysUserRoleMapper;
import com.sxw.hw_student.system.service.ISysUserRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole>
        implements ISysUserRoleService {

    @Override
    public List<SysUserRole> list(Integer userId, Long roleId) {
        QueryWrapper<SysUserRole> wrapper = new QueryWrapper<>();
        if (userId != null) {
            wrapper.eq("user_id", userId);
        }
        if (roleId != null) {
            wrapper.eq("role_id", roleId);
        }
        return this.list(wrapper);
    }


}
